//
// RS Game Framework
// Copyright © 2009 Jedd Haberstro
// jhaberstro@gmail.com
// 
// $Id:
//

#include <rs/ReferenceCounted.hpp>
#include <rs/SmartPointer.hpp>
#include <rs/unittest/UnitTest.hpp>

namespace
{
    using namespace rs;
    
    class Foo : public ReferenceCounted
    {
    public:
        Foo() : bar(5) { }
        
        int bar;
    };
    
    typedef SmartPointer< Foo > FooPtr;
    
    RS_TEST_CASE(rs::SmartPointer, Usage)
    {
        FooPtr fooptr(new Foo);
        RS_ASSERT(fooptr->bar == 5, "fooptr-> bar has incorrect value");
        RS_ASSERT(fooptr && fooptr == fooptr.GetPointer(), "fooptr has incorrect boolean semantics");
        
        FooPtr fooptr2;
        RS_ASSERT(!fooptr2 && fooptr2 == 0, "fooptr has incorrect boolean semantics");
    }

}